<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,maximum-scale=1.0" />
    <title>编辑广告模板信息</title>
    <#include "/view/admin/head.html"/>
            <script type="text/javascript" src="${base}/jstool/bootstrap-fileinput/js/fileinput.js"></script>
            <script type="text/javascript" src="${base}/jstool/bootstrap-fileinput/js/locals/zh.js"></script>
            <link rel="stylesheet" type="text/css" href="${base}/jstool/bootstrap-fileinput/css/fileinput.min.css" />
            <script type="text/javascript" src="${base}/jstool/bootstrap-switch/bootstrap-switch.min.js"></script>
            <link rel="stylesheet" type="text/css" href="${base}/jstool/bootstrap-switch/bootstrap-switch.min.css" />
            <script type="text/javascript" src="${base}/jstool/bootstrap-datetimepicker/js/bootstrap-datetimepicker.js"></script>
            <script type="text/javascript" src="${base}/jstool/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
            <link rel="stylesheet" type="text/css" href="${base}/jstool/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css" />


    <script type="text/javascript" src="${base}/jstool/bootstrap-validator-0.5.3/js/bootstrapValidator.min.js"></script>
    <script type="text/javascript" src="${base}/jstool/bootstrap-validator-0.5.3/lang/zh_CN.min.js"></script>
    <link rel="stylesheet" type="text/css" href="${base}/jstool/bootstrap-validator-0.5.3/css/bootstrapValidator.min.css" />


    <style type="text/css">
        .list-path {
            height: 50px;
            line-height: 50px;
            background-color: #9acfea;
        }

        .table-class {
            width: 90%;
            text-align: center;
            border: 1px solid #afd9ee;
            margin: 0 auto;
            margin-top: 50px;
        }

        table th {
            width: 20%;
            background-color: #d9edf7;
            text-align: right;
        }

        table td {
            width: 20%;
            text-align: left;
        }


    </style>
    <script type="text/javascript">

        $(function(){
            //初始化




                $('#picPath').fileinput({
                    language: 'zh', //设置语言
                    allowedFileExtensions : ['jpg', 'png','gif','jpeg'],//接收的文件后缀
                    showUpload: false, //是否显示上传按钮
                    showCaption: false,//是否显示标题
                    browseClass: "btn btn-primary", //按钮样式
                    previewFileIcon: "<i class='glyphicon glyphicon-king'></i>",
                });
             
                    
                    

                    $('#picPath1').fileinput({
                        language: 'zh', //设置语言
                        allowedFileExtensions : ['jpg', 'png','gif','jpeg'],//接收的文件后缀
                        showUpload: false, //是否显示上传按钮
                        showCaption: false,//是否显示标题
                        browseClass: "btn btn-primary", //按钮样式
                        previewFileIcon: "<i class='glyphicon glyphicon-king'></i>",
                    });
                    
                    $('#picPath2').fileinput({
                        language: 'zh', //设置语言
                        allowedFileExtensions : ['jpg', 'png','gif','jpeg'],//接收的文件后缀
                        showUpload: false, //是否显示上传按钮
                        showCaption: false,//是否显示标题
                        browseClass: "btn btn-primary", //按钮样式
                        previewFileIcon: "<i class='glyphicon glyphicon-king'></i>",
                    });
             



        });

    </script>
</head>
<body>

	<#include "/view/admin/listnav.html"/> 


<div class="table-class">
    <#include "/view/admin/opermsg.html"/>
    <form id="shopForm" action="${base}/czjtemp/doupdate" name="form1"
     method="post" enctype="multipart/form-data" >
    <table class="table table-bordered">

                 <input type="hidden" style="display: none" name="dataresourceId" value="${czjtemp.dataresourceId!}"/>

					
                
                   <tr>
                <tr>
                <th>模板主题</th>
                <td colspan="3">
                    <div class="form-group" >
                        <input type="text" class="form-control" id="title" name="title" placeholder="请输入模板主题" value="${czjtemp.title!}">
                    </div>
                </td>
                
		 <!--  <th>链接归类</th>
		                <td colspan="3">
		                    <div class="input-group">
								 <select id="remark"
									name="remark" class="form-control">
									<option value="0"<#if czjtemp.remark ?? &&
										czjtemp.remark=="0">selected</#if>>车主节内部模板</option>
									<option value="1"<#if czjtemp.remark ?? &&
										czjtemp.remark=="1">selected</#if>>爱车服务模板</option>
									<option value="2"<#if czjtemp.remark ?? &&
										czjtemp.remark=="2">selected</#if> >要出发模板</option>
								</select>
							</div>
		                </td> -->
                
                
                </tr>
                
                   <tr>
              <th>视频地址</th>
                
                <td colspan="3">
                    <div class="form-group">
                      <!--   <input type="text" class="form-control" id="prices" name="videoUrl" placeholder="请输入视频地址" value="${czjtemp.videoUrl!}">
                         -->
                        <textarea class="form-control" rows="3"   id="prices" name="videoUrl" placeholder="请输入视频地址" >${czjtemp.videoUrl!}</textarea>
                    </div>
                </td>
                </tr>
                
                <tr>
              <th>更多URL</th>
                
                <td colspan="3">
                    <div class="form-group">
                        <textarea class="form-control" rows="3"   id="prices" name="more" placeholder="请输入更多URL" >${czjtemp.more!}</textarea>
                    </div>
                </td>
                </tr>
				
                <tr>
                <th>模板图片</br>
  			   					假日优惠&nbsp;&nbsp;750px*491px  </br>
            		    		节日活动&nbsp;&nbsp;750px*813px </br>
  			   					严选商品&nbsp;&nbsp;750px*491px</br>
        						爱车服务&nbsp;&nbsp;750px*491px </br>
        						欢乐送&nbsp;&nbsp;750px*466px</br>
        						出行助手&nbsp;&nbsp;750px*543px 
                </th>
                <td>
                    <div class="form-group">
       <input type="file" class="form-control" id="picPath" name="file" >
                    </div>
                </td>
                <th>原模板图片
        			</th>
                <td>
            <#if czjtemp.picPath?? && czjtemp.picPath!="">
            			<div style="width:180px; height: 180px; margin-top: 5px; margin-left: 5px" id="div1">
            			<div style="width:150px; height: 150px;  margin-top: 5px; margin-left: 5px">
                        <img src="${base}${czjtemp.picPath!}"  width="150px" height="150px">
                        </div>
                        <div style="width: 40px;height:40x; background-color: ;margin-left:65px;margin-top: 5px" >
                          <a href="javascript:doDelete(${czjtemp.dataresourceId!},1)" class="btn btn-primary">删除</a>
                        </div>
                       </div>
            </#if>

                </td>
                </tr>

    <tr>
                <th>模板背景图片</br>
               (暂时没有用到)
                <td>
                    <div class="form-group">
     				 <input type="file" class="form-control" id="picPath1" name="file" >
                    </div>
                </td>
                

                
                <th>原模板背景图片</th>
                <td>
              
            <#if czjtemp.backgroundPath?? && czjtemp.backgroundPath!="">
            
            		<div style="width:180px; height: 180px; margin-top: 5px; margin-left: 5px" id="div2">
            			<div style="width:150px; height: 150px; margin-top: 5px; margin-left: 5px">
                        <img src="${base}${czjtemp.backgroundPath!}" height="150px" width="150px"/>
                         </div>
                        <div style="width: 40px;height:40x; background-color: green;margin-left:60px;margin-top: 5px "  >
                          <a href="javascript:doDelete(${czjtemp.dataresourceId!},2)"  class="btn btn-primary">删除</a>
                        </div>
                       </div>
                        
                        
            </#if>

                    
                </td>
                </tr>
                
                <#if czjtemp.dataresourceId =='6'>
                <tr>
                <th>扫一扫图片 <br/>750px*auto
                </th>
                <td>
                    <div class="form-group">
     				 <input type="file" class="form-control" id="picPath2" name="file" >
                    </div>
                </td>
                

                
                <th>原扫一扫图片</th>
                <td>
              
            <#if czjtemp.sweepImgPath?? && czjtemp.sweepImgPath!="">
            
            		<div style="width:180px; height: 180px; margin-top: 5px; margin-left: 5px" id="div3">
            			<div style="width:150px; height: 150px; margin-top: 5px; margin-left: 5px">
                        <img src="${base}${czjtemp.sweepImgPath!}" height="150px" width="150px"/>
                         </div>
                        <div style="width: 40px;height:40x; background-color: green;margin-left:60px;margin-top: 5px "  >
                          <a href="javascript:doDelete(${czjtemp.dataresourceId!},3)"  class="btn btn-primary">删除</a>
                        </div>
                       </div>
                        
                        
            </#if>

                    
                </td>
                </tr>
                </#if>

        <tr>
            <td colspan="4" width="100%" style="text-align: center;">
                <input type="button" onclick="aa()" class="btn btn-success " value="保存"/>
                <span style="width: 20px;">&nbsp;</span>
                <a class="btn btn-danger " href="javascript:window.history.go(-1)">
                   </span>返回</a>
            </td>
        </tr>

    </table>
</form>




</div>



</body>
</html>


<script type="text/javascript">

	function aa(){
		
		var picPath = $("#picPath").val();
		if(picPath !=""){
			$("#q").val("1");
		}
		var picPath1 = $("#picPath1").val();
		if(picPath1 !=""){
			$("#q1").val("1");
		}
		var picPath1 = $("#picPath1").val();
		document.form1.submit();
	}
	
	
     
 	function doDelete(id,no){
 		if(""==id){
 			alert("不能删除图片，服务器开小差了");
 			
 			return ;
 		}
 		if(""==no){
 			alert("不能删除图片，服务器开小差了");
 			return ;
 		}
 		 $
			.ajax( {
				url : "${base}/deleteImg/delteCommodity",
				data : {
					"id" :id,
					"no":no
				},
				dataType : "json",
				type : "get",
				success : function(data) {
					if(data.status==0){
						alert("服务器错误");
					}else{
						
						if(no==1){
							$("#div1").hide();
						}else if(no==2){
							$("#div2").hide();
						}else{
							$("#div3").hide();
						}
						
					}
				},
				error : function() {
					alert("服务器错误,服务器开小差了");
				}

			});
 		
 	} 
 
</script>